﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace CoreEx.Common.Extensions
{
    public static class TextWriterExtensions
    {
        public static void Write(this TextWriter textWriter, int indentLevel, string format, params object[] arguments)
        {
            for (int i = 0; i < indentLevel; i++)
            {
                textWriter.Write("\t");
            }
            textWriter.Write(format, arguments);
        }

        public static void WriteLine(this TextWriter textWriter, int indentLevel, string format, params object[] arguments)
        {
            Write(textWriter, indentLevel, format, arguments);
            textWriter.WriteLine();
        }

        public static void WriteLine(this TextWriter textWriter, int indentLevel, string value)
        {
            for (int i = 0; i < indentLevel; i++)
            {
                textWriter.Write("\t");
            }
            textWriter.WriteLine(value);
        }
    }
}
